﻿using System.Diagnostics.Contracts;
using System.Threading;
using System.Threading.Tasks;

namespace System.Reactive.Threading.Tasks
{
	public static class TaskObservableExtensions
	{
		public static IObservable<Unit> ToObservable(this Task task)
		{
			Contract.Requires(task != null, null, "task != null");
			Contract.Ensures(Contract.Result<IObservable<Unit>>() != null, null, "Contract.Result<IObservable<Unit>>() != null");
			return null;
		}

		public static IObservable<TResult> ToObservable<TResult>(this Task<TResult> task)
		{
			Contract.Requires(task != null, null, "task != null");
			Contract.Ensures(Contract.Result<IObservable<TResult>>() != null, null, "Contract.Result<IObservable<TResult>>() != null");
			return null;
		}

		public static Task<TResult> ToTask<TResult>(this IObservable<TResult> observable)
		{
			Contract.Requires(observable != null, null, "observable != null");
			Contract.Ensures(Contract.Result<Task<TResult>>() != null, null, "Contract.Result<Task<TResult>>() != null");
			return null;
		}

		public static Task<TResult> ToTask<TResult>(this IObservable<TResult> observable, object state)
		{
			Contract.Requires(observable != null, null, "observable != null");
			Contract.Ensures(Contract.Result<Task<TResult>>() != null, null, "Contract.Result<Task<TResult>>() != null");
			return null;
		}

		public static Task<TResult> ToTask<TResult>(this IObservable<TResult> observable, CancellationToken cancellationToken)
		{
			Contract.Requires(observable != null, null, "observable != null");
			Contract.Ensures(Contract.Result<Task<TResult>>() != null, null, "Contract.Result<Task<TResult>>() != null");
			return null;
		}

		public static Task<TResult> ToTask<TResult>(this IObservable<TResult> observable, CancellationToken cancellationToken, object state)
		{
			Contract.Requires(observable != null, null, "observable != null");
			Contract.Ensures(Contract.Result<Task<TResult>>() != null, null, "Contract.Result<Task<TResult>>() != null");
			return null;
		}
	}
}